local skel = fk.CreateSkill{
  name = "tea__jiexin",
}
local U = require "packages/utility/utility"
Fk:loadTranslationTable{
  ["tea__jiexin"] = "竭心",
  [":tea__jiexin"] = "你可以将两张牌当【无懈可击】或【闪】使用，然后你获得等同于其中红色牌数张【影】，若你未获得【影】，你隐匿。",
  ["#tea__jiexin-prompt"] = "竭心：你可以将两张牌当【无懈可击】或【闪】使用"
}
---@type ViewAsSkillSpec
local jiexin = {
  mute = true,
  pattern = "nullification,jink",
  prompt = "#tea__jiexin-prompt",
  interaction = function (self, player)
    local all_names = { "nullification", "jink" }
    local names = player:getViewAsCardNames(skel.name, all_names)
    if #names == 0 then return end
    return UI.CardNameBox{ choices = names, all_choices = all_names }
  end,
  card_filter = function (self, player, to_select, selected, selected_targets)
    return #selected < 2
  end,
  view_as = function (self, player, cards)
    if #cards ~= 2 or not self.interaction.data then return end
    local c = Fk:cloneCard(self.interaction.data)
    c.skillName = skel.name
    c.subcards = cards
    return c
  end,
  before_use = function (self, player, use)
    local room = player.room
    local cards = table.filter(use.card.subcards or {}, function(id)
      return Fk:getCardById(id).color == Card.Red
    end)
    room:notifySkillInvoked(player, skel.name, "special")
    if #cards > 0 then
      if use.card.trueName == "nullification" then
        player:broadcastSkillInvoke(skel.name, 1)
      else
        player:broadcastSkillInvoke(skel.name, 2)
      end
      room:moveCards({
        ids = U.getShade(room, #cards),
        to = player,
        toArea = Card.PlayerHand,
        moveReason = fk.ReasonJustMove,
        proposer = player,
        skill_name = skel.name,
        moveVisible = true,
      })
    else
      player:broadcastSkillInvoke(skel.name, 3)
      local deputy = player.deputyGeneral
      room:setPlayerMark(player, "__hidden_record", { hp = player.hp, maxHp = player.maxHp })
      room:setPlayerMark(player, "__hidden_general", player.general)
      if Fk.generals[deputy] then
        room:setPlayerMark(player, "__hidden_deputy", deputy)
      end
      room:changeHero(player, "", false, true)
      room:changeHero(player, "hiddenone", nil, nil, nil, nil, false)
    end
  end
}
skel:addEffect("viewas", jiexin)
-- Fk.generals["mouxusheng"]:addSkill(skel.name)
return skel